import 'dart:convert';

import 'package:ichinesereader/models/book/BookProgress.dart';

AudiobooksPlayList audiobooksPlayListResultFromJson(String str) =>
    AudiobooksPlayList.fromJson(json.decode(str));

String audiobooksPlayListResultToJson(AudiobooksPlayList data) =>
    json.encode(data.toJson());

class AudiobooksPlayList {
  AudiobooksPlayList({
    this.booksProgress,
    this.id,
  });

  List<BookProgress>? booksProgress;
  String? id;

  factory AudiobooksPlayList.fromJson(Map<String, dynamic> json) =>
      AudiobooksPlayList(
        booksProgress: json["booksProgress"] != null
            ? List<BookProgress>.from(
                json["booksProgress"].map((x) => BookProgress.fromJson(x)))
            : null,
        id: json["id"],
      );

  Map<String, dynamic> toJson() => {
        "booksProgress": booksProgress != null
            ? List<dynamic>.from(booksProgress!.map((x) => x.toJson()))
            : null,
        "id": id,
      };
}
